const path = require('path')
const { readJson } = require('../util/fileUtil')

// 配置文件路径
const settingFile = path.resolve(process.cwd(), "datas", "setting.json")

/**
 * 获得本地配置
 * @param {*} key 
 * @returns 
 */
const getSetting = (key) => {
    const settingData = readJson(settingFile) || {}
    if(key){
        return settingData[key]
    }
    return settingData
}

module.exports = {
    getSetting
}